// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
//
// ███╗   ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
// ████╗  ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
// ██╔██╗ ██║██║   ██║   ██║   ██║██║     █████╗
// ██║╚██╗██║██║   ██║   ██║   ██║██║     ██╔══╝
// ██║ ╚████║╚██████╔╝   ██║   ██║╚██████╗███████╗
// ╚═╝  ╚═══╝ ╚═════╝    ╚═╝   ╚═╝ ╚═════╝╚══════╝
// ------------------------------------------------
//
// This file is automatically generated.
// Please do not edit these files manually.
//
// ------------------------------------------------

#nullable restore

using Elastic.Clients.Elasticsearch.Serverless.Fluent;
using Elastic.Clients.Elasticsearch.Serverless.Serialization;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text.Json;
using System.Text.Json.Serialization;

namespace Elastic.Clients.Elasticsearch.Serverless;

public sealed partial class LatLonGeoLocation
{
	/// <summary>
	/// <para>Latitude</para>
	/// </summary>
	[JsonInclude, JsonPropertyName("lat")]
	public double Lat { get; set; }

	/// <summary>
	/// <para>Longitude</para>
	/// </summary>
	[JsonInclude, JsonPropertyName("lon")]
	public double Lon { get; set; }
}

public sealed partial class LatLonGeoLocationDescriptor : SerializableDescriptor<LatLonGeoLocationDescriptor>
{
	internal LatLonGeoLocationDescriptor(Action<LatLonGeoLocationDescriptor> configure) => configure.Invoke(this);

	public LatLonGeoLocationDescriptor() : base()
	{
	}

	private double LatValue { get; set; }
	private double LonValue { get; set; }

	/// <summary>
	/// <para>Latitude</para>
	/// </summary>
	public LatLonGeoLocationDescriptor Lat(double lat)
	{
		LatValue = lat;
		return Self;
	}

	/// <summary>
	/// <para>Longitude</para>
	/// </summary>
	public LatLonGeoLocationDescriptor Lon(double lon)
	{
		LonValue = lon;
		return Self;
	}

	protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings)
	{
		writer.WriteStartObject();
		writer.WritePropertyName("lat");
		writer.WriteNumberValue(LatValue);
		writer.WritePropertyName("lon");
		writer.WriteNumberValue(LonValue);
		writer.WriteEndObject();
	}
}